#!/bin/bash

# 提示用户输入环境变量
read -p "请输入 BROKER_ID : " NS_CTP_BROKER_ID
read -p "请输入 HOSTS (多个IP用,分隔): " NS_CTP_HOSTS
read -p "请输入 MD_PORT : " NS_CTP_MD_PORT
read -p "请输入 TD_PORT : " NS_CTP_TD_PORT
read -p "请输入 APP_ID : " NS_CTP_APP_ID
read -p "请输入 AUTH_CODE : " NS_CTP_AUTH_CODE

# 设置环境变量
echo "export NS_CTP_BROKER_ID=$NS_CTP_BROKER_ID" >> ~/.bashrc
echo "export NS_CTP_APP_ID=$NS_CTP_APP_ID" >> ~/.bashrc
echo "export NS_CTP_HOSTS=$NS_CTP_HOSTS" >> ~/.bashrc
echo "export NS_CTP_MD_PORT=$NS_CTP_MD_PORT" >> ~/.bashrc
echo "export NS_CTP_TD_PORT=$NS_CTP_TD_PORT" >> ~/.bashrc
echo "export NS_CTP_AUTH_CODE=$NS_CTP_AUTH_CODE" >> ~/.bashrc

# 使环境变量立即生效
source ~/.bashrc

echo "环境变量已成功添加。"